import { useState } from "react";

function TryUseState() {
  const [form, setForm] = useState({
    name: "John",
    age: 20,
  });

  const handleChange = () => {
    setForm({
      ...form,
      name: "Bob",
      age: 30,
    });
  };

  return (
    <div>
      <h1>Try Use State</h1>
      <p>Name: {form.name}</p>
      <p>Age: {form.age}</p>
      <button onClick={handleChange}>ChangeForm</button>
    </div>
  );
}

export default TryUseState;
